Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://gw.alicdn.com/imgextra/i4/272733888/O1CN017J2CBG1eakpTHV15s_!!272733888.jpg_Q75.jpg_.webp',
      'https://gw.alicdn.com/imgextra/i1/272733888/O1CN01XQ9nhv1eakieJyB4D_!!272733888.jpg_Q75.jpg_.webp',
      'https://gw.alicdn.com/imgextra/i2/272733888/O1CN01MITlX01eakim3laYH_!!272733888.jpg_Q75.jpg_.webp',
      'https://gw.alicdn.com/imgextra/i2/272733888/O1CN01ExujGF1eakinp1SJK_!!272733888.jpg_Q75.jpg_.webp',
      'https://gw.alicdn.com/imgextra/i3/272733888/O1CN01WDomNV1eakigVUmyQ_!!272733888.jpg_Q75.jpg_.webp'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img.alicdn.com/imgextra/i1/272733888/O1CN01KLDBmB1eakjYvPUjB_!!272733888.jpg",
      "https://img.alicdn.com/imgextra/i2/2217761826637/O1CN01lpELxP1ytnfRbkGaJ_!!2217761826637.jpg",
      "https://img.alicdn.com/imgextra/i1/2217761826637/O1CN01HmDs5g1ytnfTakLfC_!!2217761826637.jpg",
      "https://img.alicdn.com/imgextra/i3/2217761826637/O1CN01pL9pYG1ytnfScDtpp_!!2217761826637.jpg",
      "https://img.alicdn.com/imgextra/i2/2217761826637/O1CN01nwkIbo1ytnfScDA77_!!2217761826637.jpg",
      "https://img.alicdn.com/imgextra/i4/2217761826637/O1CN01RxNomS1ytnfUy4v5A_!!2217761826637.jpg",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})
